home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15328 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1022 b 

  1. Path: abc.cc.iastate.edu!pboysen
  2. From: pboysen@iastate.edu (Pete Boysen)
  3. Newsgroups: comp.lang.c++
  4. Subject: screen->metafile
  5. Date: 4 Apr 96 21:40:12 GMT
  6. Organization: Iowa State University, Ames, Iowa
  7. Message-ID: <pboysen.828654012@abc.cc.iastate.edu>
  8. NNTP-Posting-Host: abc.cc.iastate.edu
  9. Summary: How do I copy a screen bitmap to a metafile?
  10. Keywords: metafile, bitmaps
  11.  
  12. I would like to copy a rectangular bitmap defined by rect to a metaDC 
  13. however the BitBlt function always fails. How can I do this? Do I need 
  14. to use device-independent bitmaps? Below is the code I am currently using
  15. to do this:
  16.  
  17. static void SaveMetaFile(CRect *rect)
  18. {
  19.   CClientDC dc(NULL);
  20.   CMetaFileDC metaDC;
  21.   BOOL status;
  22.  
  23.   metaW = rect->Width(); metaH = rect->Height();
  24.   status = metaDC.Create(printFile);
  25.   metaDC.SetAttribDC(dc.m_hAttribDC);
  26.   status = metaDC.BitBlt(0,0,metaW,metaH,&dc,rect->left,rect->top,SRCCOPY);
  27.   metaHandle = metaDC.Close();
  28. }
  29.  
  30. -- 
  31. Pete Boysen           Iowa State University
  32. pboysen@iastate.edu   (515)294-6663
  33.  
  34.